<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>修改电影信息</title>
    <link rel="stylesheet" href="assets/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="assets/css/bootstrap-maizi.css"/>
</head>
<body>
<!--导航-->
<jsp:include page="header.jsp"></jsp:include>
<!--导航-->

<div class="container">
    <div class="row">
        <div class="col-md-2">
            <div class="list-group">
                <a href="${pageContext.request.contextPath }/adminMovie" class="list-group-item">影片列表</a>
                <a href="${pageContext.request.contextPath }/adminMovie?method=doSave" class="list-group-item active">新增影片</a>
                <a href="${pageContext.request.contextPath }/adminMovie?method=doSearch"
                   class="list-group-item">查询影片</a>
            </div>
        </div>
        <div class="col-md-10">
            <div class="page-header">
                <h1>影片管理</h1>
            </div>
            <form class="form-horizontal" role="form"
                  action="${pageContext.request.contextPath }/adminMovie?method=modify" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片ID</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput" type="text" name="id" value="${movie.id}"
                               READONLY>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片名称</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput1" type="text" name="name" value="${movie.name}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片评分</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput2" type="text" name="score" value="${movie.score}"
                               READONLY>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片简介</label>
                    <div class="col-sm-10">
                        <textarea class="form-control" id="focusedInput3" name="content"
                                  rows="5">${movie.content}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片类型</label>
                    <div class="col-sm-10">
                        <select class="form-control" name="type" id="movieType">
                            <option value="动作片">动作片</option>
                            <option value="喜剧片">喜剧片</option>
                            <option value="爱情片">爱情片</option>
                            <option value="科幻片">科幻片</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片导演</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput5" type="text" name="director"
                               value="${movie.director}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片演员</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput6" type="text" name="actor" value="${movie.actor}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">制片国家/地区</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput7" type="text" name="production_area"
                               value="${movie.production_area}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片语言</label>
                    <div class="col-sm-10">
                        <select class="form-control" name="language" id="movieLanguage">
                            <option value="中文">中文</option>
                            <option value="英语">英语</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">影片片长</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput8" type="text" name="length"
                               value="${movie.length}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">上映时间</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput9" type="text" name="release_time"
                               value="${movie.release_time}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">图片</label>
                    <div class="col-sm-10">
                        <img class="img-responsive" src="${pageContext.request.contextPath }/upload/${movie.picture}"
                             alt=""></img>
                    </div>

                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">修改图片</label>
                    <div class="col-sm-10">
                        <input class="form-control" id="focusedInput10" type="file" name="picture" value="修改图片">
                    </div>
                </div>

                <div style="margin:0 auto;width:200px;">
                    <div style="width:50%;padding:0;margin:0;float:left">
                        <button type="submit" class="btn btn-success">修改</button>
                    </div>
                    <button type="button" class="btn btn-danger"
                            onclick="location='${pageContext.request.contextPath }/adminMovie'">取消
                    </button>
                </div>

            </form>
        </div>
    </div>
</div>

<!--footer-->
<jsp:include page="footer.jsp"></jsp:include>
<!--footer-->

<script src="assets/javascripts/jquery.min.js"></script>
<script src="assets/javascripts/bootstrap.min.js"></script>
<script src="assets/javascripts/Chart.js"></script>
<script src="assets/javascripts/script.js"></script>
<script type="text/javascript">
    //为下拉框选中值
    $(document).ready(function () {
        $("#movieType option[value=${movie.type}]").attr("selected", "selected");
        $("#movieLanguage option[value=${movie.language}]").attr("selected", "selected");
        //document.getElementById("movieType")["${movie.type}"].selected=true;
        //document.getElementById("movieLanguage")["${movie.language}"].selected=true;
    });
</script>
</body>
</html>